//The sum of divisors B5

#include "stdio.h"

int main()
{
	int N=0;
	int s=0;
	if (scanf("%d",&N)!=1||N<1) return printf("ERROR\n"),1;
	s=1+N;
	for (int i=2;i<=N/2;i++) if(N%i==0) s+=i;
	printf("%d",s);
	return 0;
}
